<?php
/**
 * Created by Zhy
 * User: Zhy
 * Date: 2019/6/21
 * Time: 14:01
 */

namespace app\admin\controller;


use think\Db;
use think\Request;

class Plat extends Base
{
    /**
     * 回寄信息
     * @return mixed|\think\response\Json
     */
    public function platInfo(){
        if(Request::instance()->isPost()){
            $plat_user_name = input('plat_user_name');
            $plat_user_phone = input('plat_user_phone');
            $plat_user_address = input('plat_user_address');
            $res = Db::table('up_plat')->where('plat_id', 1)->update([
                'plat_user_name' => $plat_user_name,
                'plat_user_phone' => $plat_user_phone,
                'plat_user_address' => $plat_user_address
            ]);
            if($res){
                return json(['code' => 200, 'msg' => '编辑成功']);
            }else{
                return json(['code' => 100, 'msg' => '编辑失败']);
            }
        }
        $plat = Db::table('up_plat')->where('plat_id', 1)->find();
        $this->assign('plat', $plat);
        return $this->fetch('plat/platinfo');
    }
}